import * as types from '../mutation-type.js'

const chat = {
  state: {
    chatDot: false,
    chatList: [], // 对话列表
    searchBook: [], // 搜索出来的联系人
    searchGroupBook: [] // 搜索出来的群
  },
  mutations: {
    [types.SET_LIST] (state, data) {
      state[data.type] = data.list || []
    },
    [types.SET_DETAIL] (state, data) {
      state[data.type] = data.info
    },
    clearSearchList: (state) => {
      state.searchBook = []
      state.searchGroupBook = []
    }
  }
}

export default chat
